package
{
    import flash.events.Event;
    
    import net.akabana.fchelper.View;
    
    [SkinState("normal")]
    [SkinState("logoned")]
    public class MainView extends View{
        
        protected var isLogoned:Boolean = false;
        
        public function MainView(){
            super();            
            addEventListener("logon",onLogonHandler);
            addEventListener("logoff",onLogoffHandler);
        }
        
        private function onLogonHandler(event:Event):void{
			trace("[EVENT]",event);
            isLogoned = true;
            invalidateSkinState();
        }
        
        private function onLogoffHandler(event:Event):void{
			trace("[EVENT]",event);
            isLogoned = false;
            invalidateSkinState();
        }

        protected override function getCurrentSkinState():String{
            if( enabled ){
                if( isLogoned ){
                    return "logoned";
                } else {
                    return "normal";
                }
            } else {
                return "disabled";
            }
        }
    }
}